fix: [Advanced Orchestration] The content in the specified reply was repeated several times when the Q&A was output. #3754#3801
Conversation
…repeated several times when the Q&A was output. #3754
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| return !is_c && !isLoop(sourceNode.id, targetNode.id) | ||
| }, | ||
| }) | ||
|
|
There was a problem hiding this comment.
The provided code has a minor issue where it checks if there's a loop between nodes before determining if one node can be placed in another without causing recursion. This seems to unnecessarily double-check the non-loop condition.
Here is an improved version of the function:
validate: (
sourceNode: any,
targetNode: any,
sourceAnchor: any,
targetAnchor: any
) => {
const up_nodes = this.graphModel.getNodeIncomingNodes(targetNode.id);
const is_c_or_loop = up_nodes.some(up_node => up_node.id === sourceNode.id || isLoop(sourceNode.id, targetNode.id));
return !is_c_or_loop;
}By combining the two conditions into a single some call using logical OR (||), we avoid redundant checking. If either condition (up_node.id === sourceNode.id or isLoop) evaluates to true, the function returns false, meaning the placement is invalid due to recursion. Otherwise, it returns true.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
fix: [Advanced Orchestration] The content in the specified reply was repeated several times when the Q&A was output. #3754